/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.epos.datalogic;

import e.odbo.data.dao.I_DataLogic;
import com.openbravo.bean.ServiceCalendarDayLine;
import com.openbravo.bean.ServiceCalendarWeakLine;
import com.openbravo.data.basic.BasicException;
import com.openbravo.data.loader.I_Session;
import com.openbravo.pos.bean.ProductCategoryExt;
import com.openbravo.pos.bean.QuickPayment;
import com.openbravo.bean.AttributeInstInfo;
import com.openbravo.bean.AttributeValue;
import com.openbravo.bean.BomIncludeProductInfo;
import com.openbravo.bean.BusinessPartner;
import com.openbravo.bean.PaymentsModel;
import com.openbravo.bean.Place;
import com.openbravo.bean.Product;
import com.openbravo.bean.ProductAttributeValuePrice;
import com.openbravo.bean.ProductPrice;
import com.openbravo.bean.ProductScore;
import com.openbravo.bean.StockDiary;
import com.openbravo.pos.bean.ProductExt;
import com.openbravo.bean.ProductCustomerCategoryPrice;
import com.openbravo.bean.ProductPrefPrice;
import com.openbravo.bean.viewbean.ProductStoreView;
import com.openbravo.bean.viewbean.Product_V;
import com.openbravo.bean.Service;
import com.openbravo.bean.sales.Ticket;
import com.openbravo.bean.crm.CustomerProduct;
import com.openbravo.bean.crm.CustomerScoreDiary;
import com.openbravo.bean.crm.CustomerScoreOPEnum;
import com.openbravo.bean.crm.CustomerStoreValueCard;
import com.openbravo.bean.crm.CustomerStoreValueCardDiary;
import com.openbravo.bean.crm.StoreValueCardOPEnum;
import com.openbravo.bean.crm.physicalbond.PhysicalBond;
import com.openbravo.bean.crm.viewbean.ProductCustomerView;
import com.openbravo.bean.crm.voucher.Voucher;
import com.openbravo.bean.crm.voucher.VoucherDiary;
import com.openbravo.bean.crm.voucher.VoucherOPEnum;
import com.openbravo.bean.erp.viewbean.FrontProductAnalysisInfo;
import com.openbravo.bean.infobean.UserInfo;

import java.util.Collection;
import java.util.Date;
import java.util.List;

import net.xeoh.plugins.base.PluginManager;

/**
 *
 * @author Administrator
 */
public interface I_DataLogicSales extends I_DataLogic{

    void deleteTicket(final Ticket ticket, final String location) throws BasicException;

    BusinessPartner findCustomerByCard(String card) throws BasicException;

    double findProductStock(String warehouse, String id, String attsetinstid) throws BasicException;

    public int addCatalogProductCategory(String categoryId) throws BasicException;

    public int delCatalogProductCategory(String categoryId) throws BasicException;

    Integer getNextTicketIndex() throws BasicException;

    Integer getNextTicketPaymentIndex() throws BasicException;

    Integer getNextTicketRefundIndex() throws BasicException;

    List<ProductExt> getProductCatalog(String category) throws BasicException;

    List<ProductExt> getProductComments(String id) throws BasicException;

    Product getProductInfo(String id) throws BasicException;

    List<Product> getProductInfoByCode(String sCode) throws BasicException;

    Product getProductInfoByReference(String sReference) throws BasicException;

    ProductPrefPrice getProductPrefPriceByProductID(String id) throws BasicException;

    List<Product> getProductOnSimilarByCode(String code)throws BasicException;

    List<Product> listProductByMnemonic(String filter) throws BasicException;

    List<Product> getBomIncludeProductList(String code)throws BasicException;

    List<Product> getBomProductForIncludeList(String code)throws BasicException;

    List<Product> listProductByShared() throws BasicException;

    List<Product> getProductListAuxiliar(Object filter) throws BasicException;

    List<Product> getProductListNormal(Object filter) throws BasicException;

    List<Product> getProductList(Object filter) throws BasicException;

    List<Product> getProductBySimilarCode(String code) throws BasicException;

    List<ProductCategoryExt> getRootProductCategories() throws BasicException;

    List<ProductCategoryExt> getSubProductCategories(String category) throws BasicException;


    boolean isCashActive(String id) throws BasicException;

    Ticket loadTicket(final int tickettype, final int ticketid) throws BasicException;

    void saveTicket(final Ticket ticket, final String location) throws BasicException;

    void saveTicket(final List<Ticket> ticket, final String location) throws BasicException;

    UserInfo findPeopleByCard(String card) throws BasicException;

    UserInfo findPeopleByName(String name) throws BasicException;

    Place findPlaceByName(String name) throws BasicException;

    List listPeopleVisible() throws BasicException;

    Service findService(String serviceType, String srcId) throws BasicException;

    Service findServiceById(String id) throws BasicException;

    List listPlaceVisible() throws BasicException;

    ProductCustomerCategoryPrice findProductCustomerCategoryPrice(String productId, String customerCategoryId) throws BasicException;

    Double findCustomerCategoryPrice(String productId, String customerCategoryId) throws BasicException;
    
    List<ProductStoreView> getSimilarProductStoreQBF(Object filter)  throws BasicException;

    List<ProductStoreView> getProductBomIncludeStoreQBF(Object filter)  throws BasicException;

    List<ProductStoreView> getProductIncludeBomStoreQBF(Object filter)  throws BasicException;
    
    int stockDiaryAdd(final StockDiary diary)throws BasicException;
    
    int stockDiarySub(final StockDiary diary)throws BasicException;
    
    int stockDiaryAdd(final String customer,final StockDiary diary)throws BasicException ;
    
    int stockDiarySub(final String customer,final StockDiary diary)throws BasicException;
    
    void updateCurDebt(final double debt ,final Date date,final String customerId) throws BasicException;

    int paymentMovementInsert(QuickPayment obj)throws BasicException;
    
    int paymentMovementDelete(final String receiptId,final String paymentId)throws BasicException;

    public List<ServiceCalendarDayLine> listServiceCalendarDayLineByService(String serviceId) throws BasicException;

    public List<ServiceCalendarWeakLine> listServiceCalendarWeakLineByService(String serviceId) throws BasicException;

    PaymentsModel loadInstance(String cashIndex) throws BasicException;
    
    
    public List<Product> getBomProductForIncludeListById(String productId) throws BasicException;
    
    Product_V findProduct_VByProductId(String productId)throws BasicException;
    
    byte[] findProductImage(String productId)throws BasicException;
    

    boolean isCustomer(String location)throws BasicException;
    
    List<ProductExt> getPrefPriceProductExt() throws BasicException;

	List<ProductExt> getRecommendProducts(String productId)throws BasicException;
	
	List<Product> getBomIncludeProductListById(String productId)throws BasicException;
	
	 List<Product> getProductBySimilarCodeNoSrc( String prodcutId, String smilarCode) throws BasicException;
	 
	 List<ProductStoreView> listByIdAndVirtual( String id, boolean isVirtual) throws BasicException;

     List<ProductStoreView> listProductStoreByProductID(String filter) throws BasicException;

	CustomerStoreValueCard findStoreValueCardByNum(String value)throws BasicException;
	
	int customerStoreValueCardDiaryInsert(StoreValueCardOPEnum opType,CustomerStoreValueCardDiary diary)throws BasicException;
	
	int transferStoreValueCardValue( String descId, CustomerStoreValueCardDiary diary)throws BasicException;
	
	BusinessPartner findCustomerByStoreCard(String cardNum) throws BasicException;
	
	int customerScoreDiaryInsert( CustomerScoreOPEnum opType,final CustomerScoreDiary diary)throws BasicException;
	
	List<Product> listProductByCustomer( String customerId) throws BasicException;
	
	List<ProductCustomerView> listProductCustomerViewByProductId(String productId)throws BasicException;

	void productUpdateIn( CustomerProduct product) throws BasicException;
	
	void productUpdateOut( CustomerProduct product) throws BasicException;
	
	ProductPrice findProductPriceByGroupAndProduct(final String productId,final String groupName) throws BasicException;
	
	void productBomBalance( String locaId, String productBomId)throws BasicException;
	
	void updateCurScore(double score, Date date, String customerId) throws BasicException;
	
	int voucherDiaryInsert( VoucherOPEnum opType, VoucherDiary diary) throws BasicException;

	Voucher findVoucherByNum(String text)throws BasicException;
	
	ProductScore getProductScoreByProductAndType( String product, int type)throws BasicException;
	
	void saveTicketToQuickProduct( Ticket ticket,  int type) throws BasicException;
	
	boolean isProductOutAble(String locationId,String product)throws BasicException;
	
	boolean isProductLocked(String locationId,String product)throws BasicException;
	
	boolean isProductInAble(String locationId,String product)throws BasicException;
	
	void insertOrUpdateProductState(String locationId, String product, int state)throws BasicException;

	boolean isProductStoreEnough(String inventoryLocation, String id,double quantity)throws BasicException;

	List<ProductExt> listNewProducts()throws BasicException;
	
	List<AttributeInstInfo> listAttributeInstInfo(String attsetId)
	throws BasicException ;
	
	List<AttributeInstInfo> listAttributeInstInfo(String attsetId,
			String attsetinstid) throws BasicException;
	
	String findAttributeSetInstanceId(String attsetid,String value) throws BasicException;

	ProductAttributeValuePrice findProductAttributePrice(String attid, String value)throws BasicException;
	
	List<AttributeValue> listAttributeValueByProduct(String productId)throws BasicException;
	
    List<ProductExt> listPosShardProducts()throws BasicException;
    
    Product findProductByKeyStoke(String keyStoke)throws BasicException;
    
    List<BomIncludeProductInfo> listCascadeBomIncludeProductInfoById(String id)throws BasicException;

	PhysicalBond findPhysicalBondByCard(String text)throws BasicException;

	void physicalBondPayment(String locaId,PhysicalBond physicaBond)throws BasicException;

	
}
